Method and apparatus for enabling an executed control flow path through computer program code to be determined

ABSTRACT

A method of enabling an executed control flow path through computer program code to be determined. The method comprising modelling cumulative instruction counts for control flow paths through the computer program code, and inserting at least one probe within the computer program code to enable a cumulative instruction count value for at least one control flow path of the computer program code to be accessed.

FIELD OF THE INVENTION

The field of this invention relates to a method and apparatus forenabling an executed control flow path through computer program code tobe determined.

BACKGROUND OF THE INVENTION

Some integrated circuits enable the rapid execution of softwareapplications. During software development, it is sometimes necessary toanalyze how well various parts of the software are functioning. Thisanalysis may lead on to ‘de-bugging’ of the software as well as softwaretesting. De-bugging involves improving software reliability and softwareperformance. Software testing serves to exercise parts of the software.

Software is usually built up from blocks of linear code. Each block ofcode consists of a sequence of instructions that can be entered only atthe beginning of the code sequence, and exited only at the end of thecode sequence. So, once the program code of a block has commencedrunning, that code will be executed until the end of the block isreached. The program control flow may then select another block forexecution.

FIG. 1 shows a control flow graph 100, which is a directed graph thatprovides a diagrammatic representation of the ‘program control flow’ ofcomputer program code that makes up the piece of software. A controlflow graph comprises an ‘ENTRY’ point and an ‘EXIT’ point, and variousvertices, each of which represents a block of code within the computerprogram code. In this description, the terms ‘block of code’ and‘vertex’ may be assumed in various instances to mean the same. Thevertices in FIG. 1 are labelled A to F. The control flow graph alsoshows ‘edges’, which are the directed arrows connecting the vertices andwhich represent the control flow between the blocks of code. Thesoftware execution flows along the edges, between blocks.

When a piece of software runs, it is important to gather informationabout those blocks that are executed. This information may be gatheredby ‘instrumenting’ the source code. The source code of a block may beinstrumented by placing a ‘probe’ into it. A probe is typically a set ofinstructions whose task is to detect and signal when a particular blockruns.

When a probe is encountered, during execution of a block, the probeperforms an action or set of actions. These actions may include, forexample: incrementing a counter to show how many times the block hasbeen executed; marking a flag; or writing a token to a file. Probes mayalso, or alternatively, be associated with the edges of the control flowgraph.

It is known that the simplest method of finding out when each of theprogram blocks executes is to place a probe in every software block. Theprobe detects each time that the respective block is executed, andsignals this to a monitoring system. In effect, the program isinstrumented with probes that record passes through each part/section ofthe executed program. However, each time a probe detects and reportsthat its software block is being executed, a delay is introduced.Furthermore, the more times that probes report their software blocksbeing executed, the more data is produced, which may be required to bestored, for example within an on-die buffer. Thus, it is desirable tominimize the number of probes invoked during the program execution.

SUMMARY OF THE INVENTION

The present invention provides a method of enabling an executed controlflow path through computer program code to be determined, a method ofdetermining control flow during execution of computer program code, anapparatus for instrumenting probes within computer program code, and anintegrated circuit device as described in the accompanying claims.

Specific embodiments of the invention are set forth in the dependentclaims.

These and other aspects of the invention will be apparent from andelucidated with reference to the embodiments described hereinafter.

BRIEF DESCRIPTION OF THE DRAWINGS

Further details, aspects and embodiments of the invention will bedescribed, by way of example only, with reference to the drawings. Inthe drawings, like reference numbers are used to identify like orfunctionally similar elements. Elements in the figures are illustratedfor simplicity and clarity and have not necessarily been drawn to scale.

FIG. 1 shows an example of a conventional control flow graph forcomputer program code.

FIG. 2 shows an example of a control flow graph for computer programcode.

FIG. 3 shows an example of an expanded control flow graph for computerprogram code.

FIG. 4 shows an alternative example of a control flow graph for computerprogram code.

FIG. 5 shows an alternative example of an expanded control flow graphfor computer program code.

FIG. 6 shows an example of an algorithmic implementation of theexpansion of a loop hitting vertex.

FIG. 7 shows an alternative example of an algorithmic implementation ofthe expansion of loop hitting vertices.

FIG. 8 shows an example of a simplified block diagram of an apparatusfor performing run-time analysis of computer program code.

FIG. 9 shows a simplified flowchart of an example of a method ofenabling an executed control flow path through computer program code tobe determined.

FIG. 10 shows a simplified flowchart of an example of a method ofexpanding a control flow graph.

FIG. 11 shows a simplified flowchart of an example of a method ofdetermining control flow during execution of computer program code.

DETAILED DESCRIPTION

Referring first to FIG. 2, there is illustrated an example of a controlflow graph 200. The control flow graph 200 comprises a directed graphthat provides a diagrammatic representation of a ‘program control flow’for a piece of computer program code. The control flow graph 200comprises an ENTRY point 202 of the computer program code, and an EXITpoint 204 of the computer program code. The control flow graph 200further comprises vertices ‘A’-‘F’ 210 to 260, each of which representsa block of linear code. Each block of linear code consists of a sequenceof instructions that can be entered only at the beginning, and exitedonly at the end. So, once the program code of a block has begun running,that code will be executed until the end of the block is reached. Thevertices 210 to 260 in FIG. 2 are labelled A to F. The control flowgraph 200 also shows ‘edges’ 270, which are the directed arrowsconnecting the vertices 210 to 260, and which represent possible controlflow between the blocks of code.

Each block of code, represented within the control flow graph 200 as avertex 210 to 260, comprises a certain number of instructions to beexecuted, the various blocks of code/vertices 210 to 260 typicallycomprising different numbers of instructions. For example, the number ofinstructions within each block of code is identified in FIG. 2 withinthe respective vertex as a numerical value below the vertex label. Thus,the block of code represented by vertex A 210 comprises two instructionsto be executed; the block of code represented by vertex B 220 comprisesthree instructions to be executed; etc.

As can be seen, different paths through the control flow graph 200 fromthe ENTRY point 202 to the EXIT point 204 will require different numbersof instructions to be executed. Thus, it has been recognised by theinventor that the control flow during execution of the computer programcode represented by the control flow graph 200 may be at least partlydetermined based on an instruction count for the execution of thecomputer program code. In particular, in a simple case where eachindividual control flow path through the control flow graph 210 to 260comprises a different number of instructions to be executed, thespecific control flow during execution of the computer program coderepresented thereby may be determined solely by an indication of theinstruction count following execution. In some examples, this may beachieved by way of a single probe being instrumented within, for theillustrated example, the block of code represented by the last vertex F260 of the control flow graph 200, with said probe enabling aninstruction counter to be accessed, such as is typically provided withinmodern instruction processing modules. Thus, the control flow duringexecution of the computer program code may be determined by using just asingle probe (at least for the simplified illustrated example), therebyminimizing the potentially adverse effects on the execution of thecomputer program code caused by the inclusion of probes therein.

Thus, and in accordance with some example embodiments of the presentinvention, there is provided a method of enabling an executed controlflow path through computer program code to be determined. The methodcomprises modelling cumulative instruction counts for control flow pathsthrough the computer program code, and instrumenting at least one probewithin the computer program code to access a cumulative instructioncount value for at least one control flow path of the computer programcode. In this manner, and as identified above, the specific control flowduring execution of the computer program code may be determined based onthe instruction count value accessed by the probe.

For the conventional control flow graph 200 illustrated in FIG. 2, eachblock of code is represented by a single vertex 210 to 260, with controlflow there between represented by the edges 270. As each vertex 210 to260 of FIG. 2 represents all instances of a block of code (i.e. withinall control flow paths), irrespective of the path taken to reach thatblock of code, the conventional control flow graph 200 of FIG. 2 is notoptimized for differentiating between different control flow pathsthrough the computer program code, and in particular is not optimizedfor tracing cumulative instruction counts through the different controlflow paths of the computer program code represented thereby.

FIG. 3 illustrates an expanded control flow graph 300, and in particularillustrates an expanded version of the conventional control flow graph200 of FIG. 2. For the expanded control flow graph 300, the vertices210-260 of the conventional control flow graph 200 are expanded toprovide vertices 310-366 representing individual instances of blocks ofcode within different control flow paths through the computer programcode. A cumulative instruction count value is determined for each of thevertices 310-366 within the expanded control flow graph 300. For theillustrated example, the cumulative instruction count value (cic) foreach vertex 310-366 is included within the naming convention:original_name.cic. Thus, for the first vertex A.2 310 in the expandedcontrol flow graph 300, which is derived from the first vertex A 210 inthe control flow graph 200 of FIG. 2, a cumulative instruction countvalue (cic) of ‘2’ is determined, i.e. the sum of instructions withinthe computer program code up to and including that instance of the blockof code.

Thus, in this manner, by representing individual instances of the blocksof code within different control flow paths through the computer programcode with separate vertices, and by determining cumulative instructioncount values for each vertex 310-366, and thus for each instance of eachblock of code, the cumulative instruction count values for control flowpaths through the computer program code may be modelled to enableefficient instrumenting of probes within the computer program code, andthereby to enable an executed control flow path through the computerprogram code to be determined.

In particular, by generating such an expanded control flow graph, thecumulative instruction count values for the different possible controlflow paths through the computer program code are able to be effectivelymodelled and analysed in order to enable an optimal (e.g. minimum) setof probes to be instrumented within the computer program code in orderto enable control flow there through to be traced. For example, for theexpanded control flow graph 300 of FIG. 3, it can clearly be seen thatthere are four possible control flow paths through the computer programcode; each control flow path ending at a unique instance of the block ofcode F represented by vertices 360, 362, 364, 366.

In addition, the cumulative instruction count values for the controlflow paths through the computer program code are defined within therespective vertices 360, 362, 364, 366. As such, an optimal (e.g.minimum) set of probes to be instrumented within the computer programcode may be determined based on the cumulative instruction count valuesfor each control flow path. In particular for the illustrated example,it can clearly be seen from the cumulative instruction count values ofeach instance of the block of code F 360, 362, 364, 366 that the variouscontrol flow paths comprise different cumulative instruction countvalues; specifically the first instance of the block of code F (F.17)360 comprises a cumulative instruction count value of 17, the secondinstance of the block of code F (F.16)362 comprises a cumulativeinstruction count value of 16, the third instance of the block of code F(F.14) 364 comprises a cumulative instruction count value of 14, and thefourth instance of the block of code F (F.13) 366 comprises a cumulativeinstruction count value of 13.

Thus, the control flow during execution of the computer program code maybe determined simply by determining an instruction count followingexecution. Thus, the control flow through the computer program coderepresented by the control flow graph 200 and the expanded control flowgraph 300 may be traced by inserting a probe within a single block ofcode, such as within an ‘exiting’ block of code (e.g. a block of codefollowing which the computer program code returns or exits) representedby vertex F 260 and vertices F.360, F.362, F.364, F.366, respectively,with the probe being arranged to enable an instruction count value forthe execution of the computer program code to be accessed. For example,such a probe may simply comprise a breakpoint to enable a debugger orother external hardware device to access an instruction counter.Alternatively, such a probe may cause a processing module executing thecomputer program code to read and output an instruction count for theexecution of the computer program code. In some examples, theinstruction count may be output to a memory element for later retrievalor directly to a debugger or other external hardware device.

In some examples, the expanded control flow graph 300 of the illustratedexample may represent the control flow for a relatively simple andstraightforward computer program, where typical computer programscomprise far more complex control flows comprising many more possiblecontrol flow paths. As such, determining an optimal set of probes forenabling the tracing etc. of computer program execution can be a complexprocess, for which various techniques and methods have been developed.Such known techniques and methods include, by way of example, methodsbased on Kirchhoff's law such the Knuth-Stevenson program frequencymethod: D. E. Knuth and F. R. Stevenson, ‘Optimal measurement points forcounts’, BIT, 13(3): 313-322, 1973, as well as methods based ondominance such as described in: Hiralal Agrawal. ‘Dominators, superblocks, and program coverage’, In Conference Record of Principles ofProgramming Languages—94: 21st ACM SIGPLAN-SIGACT Symposium onPrinciples of Programming Languages, pages 25-34, Portland, Oreg., 1994.In some examples, such techniques and methods for optimizing the numberof probes required to be instrumented within computer program code maybe capable of being implemented alongside the proposed architecture andmethods.

Known techniques and methods for probe optimization typically utiliseconventional control flow graphs. Accordingly, by using an expandedcontrol flow graph, such as illustrated in FIG. 3 to model cumulativeinstruction counts for control flow paths through the computer programcode, the semantics of the corresponding conventional control flow graphare preserved (e.g. the expanded control flow graph contains only thepaths within the computer program code that are modelled by theconventional control flow graph). Thus, the use of such an expandedcontrol flow path enables, at least for some example embodiments of thepresent invention, to be implemented alongside other known techniquesand methods for probe optimization that use conventional control flowgraphs.

For the examples illustrated in FIGS. 2 and 3, the control flow graphs200, 300 represent acyclic computer program code, i.e. computer programcode comprising no loops or other cyclical characteristics. Accordingly,control flow through the computer program code is substantially linear.Thus, cumulative instruction count values are deterministic andsingularly definable for each instance of a block of code. However,computer program code often comprises loops or other cyclicalcharacteristics that may lead to potentially infinite possibilities withregard to control flow paths through the computer program code duringexecution.

FIG. 4 illustrates a simple example of a control flow graph 400 forcomputer program code comprising such a loop. In a similar manner to theacyclic control flow graph 200 of FIG. 2, the control flow graph 400 ofFIG. 4 comprises an ENTRY point 402 of the computer program code, and anEXIT point 404 of the computer program code. The control flow graph 400further comprises vertices 410 to 450, each of which represents a blockof linear code. The vertices 410 to 450 in FIG. 4 are labelled A to E.The control flow graph 400 also shows ‘edges’ 470, 475, which are thedirected arrows connecting the vertices 410 to 450, and which representpossible control flow between the blocks of code. In particular, for thecontrol flow graph 400 of FIG. 4, the computer program code beingrepresented comprises a loop from the block of code represented byvertex D 440 back to the block of code represented by vertex B 420. Thisloop is represented in the control flow graph 400 by the edge 475. Insome examples, such a loop may introduce a potential for infinitecontrol flow paths through the computer program code, since an executedcontrol flow may potentially involve any number of loop iterations.Thus, in order to model cumulative instruction counts for control flowpaths through computer program code, any loops or other cycliccharacteristics within the computer program code must be taken intoconsideration.

FIG. 5 illustrates an expanded control flow graph 500 corresponding tothe conventional control flow graph 400 of FIG. 4. For the expandedcontrol flow graph 500, the vertices 410 to 450 of the conventionalcontrol flow graph 400 are expanded to provide vertices 510 to 555representing individual instances of blocks of code within differentcontrol flow paths through the computer program code. A cumulativeinstruction count value is determined for each of the vertices 510 to555 within the expanded control flow graph 500 in order to enable thecumulative instruction counts for control flow paths through thecomputer program code to be modelled. As for the example illustrated inFIG. 3, the cumulative instruction count value (cic) for each vertex 510to 555 is included within the naming convention: original_name.cic.Thus, for the first vertex A.2 510 in the expanded control flow graph500, which is derived from the first vertex A 410 in the control flowgraph 400 of FIG. 4, a cumulative instruction count value (cic) of ‘2’is determined, i.e. a sum of instructions within the computer programcode up to and including that instance of the block of code.

As identified above, the computer program code represented by theconventional control flow graph 400, and thus also by the expandedcontrol flow graph 500, comprises a loop. This loop is represented inthe conventional control flow graph 400 by the edge 475, which providesfor a control flow from the block of code represented by vertex D 440back to the block of code represented by vertex B 420. For the expandedcontrol flow graph 500, a cumulative instruction count value isdetermined for each of the vertices 510 to 555 in order to enable thecumulative instruction counts for control flow paths through thecomputer program code to be modelled.

In order to enable the effect on the instruction count value of the looprepresented by the edge 475 within the conventional control flow graph400 to be modelled, the vertex B 420 of the conventional control flowgraph 400 is expanded within the expanded control flow graph 500 tocomprise, for the illustrated example, a first, reference vertex B.5 520representing a first instance of the respective block of code, and asecond, return vertex B.14 525 representing a second instance of therespective block of code. Specifically, for the example illustrated inFIG. 5, the loop reference vertex B.5 520 represents a referenceinstance of the respective block of code, which for the illustratedexample comprises the first instance for the block of code within thecontrol flow of the computer program code. This loop reference vertexB.5 520 comprises a cumulative instruction count value representative ofa sum of instructions within the computer program code up to andincluding that instance of the block of code, namely a cumulativeinstruction count value of five. The second, return vertex B.14 525represents a return instance of the block of code within the controlflow of the computer program code. This return vertex B.14 525 comprisesa cumulative instruction count value that is representative of the sumof instructions within the computer program code up to and includingthat instance of the block of code, namely a cumulative instructioncount value of fourteen.

In order for the cumulative instruction count values for vertices withinthe expanded control flow graph 500 following the loop in the computerprogram code to remain valid, a regressive edge, illustrated at 575 isprovided from the return vertex B.14 525 back to the loop referencevertex B.5 520. This regressive edge represents, in accordance with someexample embodiments, resetting the instruction counter back to 5, whichis the cic value of the vertex B.5 520. This requires a probe to beallocated to the vertex B 420 within the conventional control flow graph400, and by way of instrumenting a probe therein an instruction countfor the execution of the computer program code is decremented, orotherwise reverted back, from a value that is representative of thereturn instance of the block of code (e.g. fourteen) to a value that isrepresentative of the reference instance of the block of code (e.g.five). In this manner, the instruction count of a looped control flowfor the computer program code is bound, thereby enabling the cumulativeinstruction count values for vertices within the expanded control flowgraph 500 following the loop in the computer program code to remainbound. A probe instrumented within the computer program code to boundthe instruction count in this manner may be further arranged to log,record frequency, or otherwise enable the tracking of, each instance ofthe respective loop.

Thus, the control flow through the computer program code that isrepresented by the expanded control flow graph 500 may be traced byinstrumenting just two vertices: a first probe inserted within the blockof code represented by vertex E 450, 550, 555, this first probe beingarranged to enable an instruction count value for the execution of thecomputer program code to be accessed; and a second probe inserted withinthe block of code represented by vertex, B 420, 520, 525, this secondprobe being arranged to enable an instruction count value for theexecution of the computer program code to be both accessed and writtento in order to enable an instruction count for the execution of thecomputer program code to be bounded. Both probes may use the cumulativeinstruction count to record frequencies, vertex labels or otherstatistical data.

Each loop in a control flow graph may have at least one vertex with aprobe allocated to it in order to keep the cic number bound. Such aprobe may record repetitive execution of the loop and also modify theinstruction counter to keep the cic number bound. For a control flowgraph, a set of vertices for which every loop contains at least onevertex from the set is called Loop Hitting Set (LHS). A loop hittingvertex is a vertex from the LHS. A regression vertex is a vertex in anexpanded control flow graph the origin of which belongs to the LHS. Itis desirable in order to limit the number of probes to find such an LHSthat is minimal; however, this is an intractable problem, and any LHS issufficient for keeping the instruction count bound. For FIG. 4 and FIG.5, the LHS comprises vertex B 420, 520, 525 only.

FIG. 6 illustrates an example of an algorithmic implementation of theexpansion of the loop hitting vertex B 420 of the conventional controlflow graph 400. For the simplified example illustrated in FIG. 4, thecomputer program code comprises only a single control flow path that isinitially leading from the ENTRY 402 to the loop hitting vertex B 420.However, in practice, for each loop hitting vertex within a conventionalcontrol flow graph, there may be any number of control flow pathsinitially leading to the loop hitting vertex from an entry point of thecontrol flow graph, each such control flow path potentially comprising adifferent cumulative instruction count value. Accordingly, and asillustrated in FIG. 6, the loop hitting vertex B 420 of FIG. 4 may beexpanded to several regression B.x vertices, illustrated generally bymulti-vertex B_xn0 620; for each B.x vertex there is a control flow pathleading from the ENTRY 402 to an initial instance of the loop hittingvertex B 420. A loop reference vertex B_n0 520 (labelled B.5 in FIG. 5)is then created for the loop hitting vertex B 420. As described above,this loop reference vertex B_n0 520 is assigned a cumulative instructioncount value that is representative of the sum of instructions within thecomputer program code up to and including that instance of the block ofcode, namely a cumulative instruction count value of five for theexample illustrated in FIG. 5. More specifically, in order to accuratelyrepresent all control flow paths leading to the loop hitting vertex B420 from the ENTRY 402, the loop reference vertex B_n0 520 is assigned acumulative instruction count value that is greater than or equal to eachof the cumulative instruction count values of the set of regressionvertices B_xn0 620. So, for example, the loop reference vertex B_n0 520may be assigned a cumulative instruction count value that is equal tothe largest of the cumulative instruction count values of the set ofregression vertices 620, which for the simplified illustrated example isfive. A forward regressive edge, illustrated at 675, is created fromeach of the regression vertices B_xn0 620 to the loop reference vertexB_n0 520. Each of these forward regressive edges 675 represents, inaccordance with some example embodiments, setting the instructioncounter to the cic value of B_n0. In this manner, an instruction countfor the execution of the computer program code may be incremented, orotherwise modified, where necessary to a value representative of thecumulative instruction count value assigned to the loop reference vertexB_n0 520 (e.g. five for the illustrated example). A probe or the likeinstrumented within the computer program code to modify the instructioncount in this manner may be further arranged to log, or otherwise enablethe tracking of, any such modification to the instruction count toenable the control flow path up to that point to be determined. In someexamples, since the simplified example illustrated in FIGS. 4 and 5comprises only a single control flow path between the ENTRY 402 and theloop hitting vertex B 420, a forward regression vertex was notillustrated in FIG. 5 to simplify the initial explanation of theexpanding of the control flow graph.

The loop hitting vertex B 420 of FIG. 4 may be further expanded tocomprise a set of return vertices B_xn1, illustrated generally at 625,for each control flow path looping back to the loop hitting vertex B 420of FIG. 4. Thus, for the illustrated example, since only a singlecontrol flow path loops back to the loop hitting vertex 420 of FIG. 4,B_xn1 625 contains only a single vertex. The set of return vertices 625represents return instances of the block of code within the control flowof the computer program code. Each vertex in the set of return vertices625 comprises a cumulative instruction count value that isrepresentative of the cumulative instruction count up to and includingthat instance of the block of code, which for the illustrated examplecomprises a cumulative instruction count value of fourteen, asillustrated in FIG. 5. In order for the cumulative instruction countvalues for vertices within the expanded control flow graph 500 followingthe loop in the computer program code to remain bound, a regressiveedge, illustrated at 575 is provided from each return vertex in B_xn1625 back to the loop reference vertex B_n0 520. Note that 575 representsa set of regressive edges. As previously described, such a regressiveedge in 575 represents, in accordance with some example embodiments,resetting the instruction counter back to the cic value of B_n0. In thismanner, an instruction count for the execution of the computer programcode may be decremented, or otherwise reverted back, from a value thatis representative of the return instance of the block of code (e.g.fourteen) to a value that is representative of the reference instance ofthe block of code (e.g. five).

In this manner, the instruction count of a looped control flow for thecomputer program code may be bound, thereby enabling the cumulativeinstruction count values for vertices within the expanded control flowgraph 500, 600 following the loop in the computer program code to remainvalid. A loop hitting vertex instrumented within the computer programcode to bound the instruction count in this manner may be furtherarranged to log, or otherwise enable the tracking of, each instance ofthe respective loop.

In some examples, the control flow graphs for the example illustrated inFIGS. 4 to 6 represent a simple example of control flow for computerprogram code. In particular, the computer program code comprises only asingle loop, and only a single control flow path initially leading tothe loop reference vertex B.5 520, and only a single control flow pathlooping back via a single return vertex B.14 525. FIG. 7 illustrates anexample of a canonical algorithmic implementation of the expansion forloops within computer program code in order to demonstrate moregenerally an example of a principle of expanding cyclic control flowgraphs. For the example illustrated in FIG. 7, a control flow graph 700to be expanded comprises an ENTRY 702, and EXIT 704 and two loop hittingvertices, K and R. Thus, the control flow graph 700 comprises a loophitting set: LHS={K,R}. The loop hitting set (LHS) of a control flowgraph comprises all vertices within the conventional control flow graphat which a regressive edge (i.e. a loop) terminates. Accordingly, nocontrol flow path should encounter the same vertex more than oncewithout encountering at least one vertex within the LHS betweenencounters of that same vertex.

Expansion of the control flow graph 700 may begin at the ENTRY 702, andmay be performed in steps, starting with generating a set of regressionvertices from the ENTRY 702 for each of the vertices within the loophitting set, such as illustrated by K_xn0 710 and R_xn0 712. Each set ofregression vertices K_xn0 710 and R_xn0 712 represents the variouscontrol flow paths from the ENTRY 702 to an initial instance of therespective loop hitting vertex.

Expansion of the control flow path 700 may then continue with thecreation of a loop reference vertex K_n0 720 for the loop hitting vertexK. The loop reference vertex K_n0 720 is assigned a cumulativeinstruction count value that is representative of the cumulativeinstruction count up to and including that instance of the block ofcode. More specifically, in order to accurately represent all controlflow paths leading to the loop hitting vertex K from the ENTRY 702, theloop reference vertex K_n0 720 is assigned a cumulative instructioncount value that is greater than or equal to each of the cumulativeinstruction count values of the set of regression vertices K_xn0 710 andR_xn0 712. So, for example, the loop reference vertex K_n0 720 may beassigned a cumulative instruction count value equal to the largest ofthe cumulative instruction count values of the set of regressionvertices K_xn0 710 and R_xn0 712.

A forward regressive edge, illustrated at 715, is created from each ofthe forward regressive vertices within the set of regression verticesK_xn0 710 to the loop reference vertex K_n0 720. Each of these forwardregressive edges 715 represents, in accordance with some exampleembodiments, setting the instruction counter to the cic number assignedto the loop reference vertex K_n0 720. In this manner, an instructioncount for the execution of the computer program code may be incremented,or otherwise modified, where necessary to a value that is representativeof the cumulative instruction count value assigned to the loop referencevertex K_n0 720.

The expansion of the control flow graph 700 may then continue, as shown.Control flow paths that loop back to the loop hitting vertex K may belogically arranged into sets of control flow paths; a first set ofcontrol flow paths comprising ‘linear’ control flow paths, for examplecontrol flow paths that comprise no further loops or the like; and forthe illustrated example a further set of control flow paths comprisingcontrol flow paths comprising at least one instance of the second loophitting vertex R. Accordingly, for the illustrated example, the controlflow path 700 may be further expanded with the creation of a set ofreturn vertices K_xn1, illustrated generally at 730, for each linearcontrol flow path looping back to the loop hitting vertex K, and a setof regression vertices R_xn1 750 for the loop hitting vertex R for eachcontrol flow path comprising at least one instance of the second loophitting vertex R. Each vertex within the set of return vertices K_xn1730 comprises a cumulative instruction count value that isrepresentative of the cumulative instruction count up to and includingthat return instance of the respective block of code. A regressive edge,illustrated at 735 and representing a set of regressive edges, isprovided from each return vertex within the set of return vertices K_xn1730 back to the loop reference vertex K_n0 720. Similarly, each vertexwithin the set of regression vertices R_xn1 750 comprises a cumulativeinstruction count value that is representative of the cumulativeinstruction count up to, and including, that instance of the respectiveblock of code.

Expansion of the control flow path 700 may then continue with thecreation of a loop reference vertex R_n1 760 for the loop hitting vertexR. The loop reference vertex R_n1 760 is assigned a cumulativeinstruction count value that is representative of the cumulativeinstruction count up to and including that instance of the block ofcode. More specifically, in order to accurately represent all controlflow paths leading to the loop hitting vertex R from the loop hittingvertex K, the loop reference vertex R_n1 760 is assigned a cumulativeinstruction count value that is greater than or equal to each of thecumulative instruction count values of the set of regression verticesR_xn1 750 and K_xn1 730. So, for example, the loop reference vertex R_n1760 may be assigned a cumulative instruction count value equal to thelargest of the cumulative instruction count values of the set ofregression vertices R_xn1 750 and K_xn1 730. A forward regressive edge,illustrated at 755, is created from each of the regression verticesR_xn1 750 to the loop reference vertex R_n1 760. Each of these forwardregressive edges 755 represents, in accordance with some exampleembodiments, setting the instruction counter to the cic number assignedto R_n1 760. In this manner, an instruction count for the execution ofthe computer program code may be incremented, or otherwise modified,where necessary to a value that is representative of the cumulativeinstruction count value assigned to the loop reference vertex R_n1 760.

The control flow path 700 may then be further expanded with the creationof a set of return vertices R_xn2, illustrated generally at 770, foreach linear control flow path looping back to the loop hitting vertex R,and a set of regression vertices K_xn2 740 for the loop hitting vertex Kfor each control flow path comprising at least one further instance ofthe first loop hitting vertex K. Each vertex within the set of returnvertices R_xn2 770 comprises a cumulative instruction count value thatis representative of the cumulative instruction count up to andincluding that return instance of the respective block of code. Aregressive edge, illustrated at 775 and representing a set of regressiveedges, is provided from each return vertex within the set of returnvertices R_xn2 770 back to the loop reference vertex R_n1 760.

Similarly, each vertex within the set of regression vertices K_xn2 740comprises a cumulative instruction count value that is representative ofthe cumulative instruction count up to and including that instance ofthe respective block of code. A regressive edge, illustrated at 745, isprovided from each return vertex within the set of return vertices K_xn2740 back to the loop reference vertex K_n0 720. As previously described,such a regressive edge 735, 745 represents, in accordance with someexample embodiments, resetting the instruction counter back to the cicvalue of K_n0 720. In this manner, an instruction count for theexecution of the computer program code may be decremented, or otherwisereverted back, from a value that is representative of the returninstance of the block of code to a value that is representative of thereference instance of the block of code. In this manner, the instructioncount of the looped control flow for the computer program code is bound,thereby enabling the cumulative instruction count values for verticeswithin the expanded control flow graph following the loop in thecomputer program code to remain valid.

Expansion of the control flow path 700 may then continue by revertingback to the set of regression vertices R_xn0 712, and with the creationof a loop reference vertex R_n3 722 for the loop hitting vertex R. Theexpansion of the control flow path 700 may then continue in the samemanner as described above for the loop hitting vertex K, as illustratedon the left hand side of the control flow graph 700 of FIG. 7, for theloop hitting vertex R as illustrated on the right hand side of thecontrol flow graph 700. As shown, the same process (albeit with the loophitting vertices K and R switched) may be performed for expanding thevertices etc. for this case.

Thus, an example of a method of enabling an executed control flow paththrough computer program code to be determined using instruction countvalues has been described in which fewer probes may be required to beinstrumented within the computer program code in order to record passesthrough the different parts thereof. Furthermore, by using an expandedcontrol flow graph to model cumulative instruction counts for controlflow paths through the computer program code, the semantics of thecorresponding conventional control flow graph may be preserved (e.g. theexpanded control flow graph contains only the paths within the computerprogram code that are modelled by the conventional control flow graph).Thus, the use of such an expanded control flow path may enable examplesof the present invention to be implemented alongside other knowntechniques and methods for probe optimization that use conventionalcontrol flow graphs.

In some examples, by enabling the number of probes required to beinstrumented within computer program code to be reduced, less intrusivecode tracing may be achievable, thereby improving run-time analysis forthe computer program code, and thereby facilitating the development ofproficient computer program code, and thus the development of devices inwhich such computer program code may be employed. Non-intrusive codetracing is particularly desirable for the development of embedded andreal-time applications.

For example, FIG. 8 illustrates an example of a simplified block diagramof an apparatus 800 for performing run-time analysis of computer programcode. The apparatus 800 comprises an integrated circuit device 810arranged to execute computer program code for which run-time analysis isto be performed. The integrated circuit device 810 comprises at leastone processing module 815, for example a microprocessor or centralprocessing unit (CPU), arranged to execute computer program code. Theintegrated circuit device 810 further comprises at least one memorymodule 820 in which computer program code to be executed and data may bestored and accessed by the at least one processing module 815. Theapparatus 800 further comprises a host 830, such as a personal computer(PC) or the like, and which also comprises at least one processingmodule 835 and at least one memory module 840. The host 830 furthercomprises a user interface 845, and is arranged to provide variouscomputer program code development and analysis tools, for example by wayof applications stored within memory 840 and arranged to be executed bythe processing module 835.

In accordance with some examples of the present invention, cumulativeinstruction counts for control flow paths through computer program codeto be analysed are modelled within the host 830, for example by way ofan expanded control flow graph as described above. One or more verticesare then instrumented within the computer program code to enable aninstruction count for the execution of the computer program code to beaccessed. For example, probes may be placed within the source code ofthe computer program code. The computer program code (with the verticesinstrumented therein) may then be compiled, and loaded into the memory820 of the integrated circuit device 810 for execution. For example, thecompiled computer program code may be ‘flashed’ via a debugger 850operably coupled to a debug port 825 of the integrated circuit device810 into the memory 820 thereof, as illustrated generally at 822. Havingbeen loaded into the memory 820 of the integrated circuit device 810,the computer program code 822 may then be executed by the one or moreprocessing module(s) 815 thereof. During execution, the probesinstrumented within the computer program code 822, and indicatedgenerally at 824 for illustration purposes, may enable an instructioncount for the execution of the computer program code to be accessed. Forexample, modern instruction processing modules typically compriseinstruction counters, such as illustrated at 817 in FIG. 8. Such aninstruction counter may comprise, for example, a 16-bit or 32-bitregister that is incremented by the processing module 815 duringexecution. Accordingly, during execution, the probes 824 instrumentedwithin the computer program code 822 may enable the value held withinsuch a register to be accessed, for example by the debugger 850. Theprobes 824 may further enable decrementing or other means of boundingthe instruction counter 817, for example as described above in relationto loops etc. within the computer program code 822, as well as thenumber of times a loop is executed. In this manner, the instructioncount value may be used to determine the control flow path duringexecution of the computer program code 822 based on the modelledcumulative instruction counts for control flow paths through thecomputer program code.

For the various examples hereinbefore described, a method of enabling anexecuted control flow path through computer program code to bedetermined has been described in which the instruction count duringexecution of the computer program code has been used to model and tracecontrol flow during execution. In such a manner, such an instructioncount may correspond to the number of instructions executed by, for theexample illustrated in FIG. 8, the processing module 815. Alternatively,such an instruction count may correspond to the number of processingcycles over which the instructions are executed. It will thus beappreciated that the term ‘instruction count’ used herein encompassesany such indication of processing progress.

Referring now to FIG. 9, there is illustrated a simplified flowchart 900of an example of a method of enabling an executed control flow paththrough computer program code to be determined, such as may beimplemented within, say, the host 830 of FIG. 8. The method starts at910, and moves on to 920 with a receipt of computer program code to beanalysed. A conventional control flow graph for the received computerprogram code is then constructed at 930. The control flow graph is thenexpanded at 940 to comprise vertices representing individual instancesof blocks of code within different control flow paths through thecomputer program code, and to comprise cumulative instruction countvalues. A reduced set of probes to insert within the computer programcode may be then determined based at least partly on the cumulativeinstruction count values within the expanded control flow graph at 950.Advantageously, the reduced set of probes may be determined using knowntechniques and methods for probe optimization using the conventionalcontrol flow graph in conjunction with the cumulative instruction countvalues within the expanded control flow graph. The reduced set of probesmay be then inserted within the computer program code at 960, and themethod ends at 970.

FIG. 10 illustrates a simplified flowchart 1000 of an example of amethod of expanding a control flow graph, for example as may beimplemented within the method of FIG. 9 at 950. The method starts at1010 and moves on to 1020 where cyclic control flow paths areidentified, and a loop hitting set of vertices is defined comprising theloop hitting vertices within the identified cyclic control flow paths at1030. Next, at 1040, the control flow graph is expanded to comprisevertices that represent individual instances of blocks of code withindifferent control flow paths through the computer program code. Acumulative instruction count is determined for each expanded vertex, asillustrated at 1050. For some examples, the determination of acumulative instruction count for each expanded vertex may be performedduring expansion of the control flow graph. As such, the contents ofsteps 1040 and 1050 may equally (and optionally) be merged into a singlestep, as illustrated at 1060. The method then ends at 1070.

Referring now to FIG. 11, there is illustrated a simplified flowchart1100 of an example of a method of determining control flow duringexecution of computer program code, such as may be implemented withinhost 830 of FIG. 8. The method starts at 1110 and comprises insertingprobes within the computer program code at 1120, executing the computerprogram code within an instruction processing module at 1130, receivingat least one indication of at least one instruction count value for theexecution of the computer program code at 1140, and determining thecontrol flow during the execution of the computer program code based atleast partly on the received indication of an instruction count valuetherefor at 1150. For example, an instruction count may be read whenevera probe is executed, and the control flow may be determined based on,say, an instruction count read and a vertex identifier (label)corresponding to the vertex within which the probe was inserted. Themethod ends at 1160.

Because the illustrated embodiments of the present invention may for themost part, be implemented using electronic components and circuits knownto those skilled in the art, details have not be explained in anygreater extent than that considered necessary as illustrated above, forthe understanding and appreciation of the underlying concepts of thepresent invention and in order not to obfuscate or distract from theteachings of the present invention.

As will be appreciated by a skilled artisan, the invention may beimplemented, as a whole or in part, in a computer program for running ona computer system, at least including code portions for performing stepsof a method according to the invention when run on a programmableapparatus, such as a computer system or enabling a programmableapparatus to perform functions of a device or system according to theinvention.

A computer program is a list of instructions such as a particularapplication program and/or an operating system. The computer program mayfor instance include one or more of: a subroutine, a function, aprocedure, an object method, an object implementation, an executableapplication, an applet, a servlet, a source code, an object code, ashared library/dynamic load library and/or other sequence ofinstructions designed for execution on a computer system.

The computer program may be stored internally on computer readablestorage medium or transmitted to the computer system via a computerreadable transmission medium. All or some of the computer program may beprovided on computer readable media permanently, removably or remotelycoupled to an information processing system. The computer readable mediamay include, for example and without limitation, any number of thefollowing: magnetic storage media including disk and tape storage media;optical storage media such as compact disk media (e.g., CD-ROM, CD-R,etc.) and digital video disk storage media; non-volatile memory storagemedia including semiconductor-based memory units such as FLASH memory,EEPROM, EPROM, ROM; ferromagnetic digital memories; MRAM; volatilestorage media including registers, buffers or caches, main memory, RAM,etc.; and data transmission media including computer networks,point-to-point telecommunication equipment, and carrier wavetransmission media, just to name a few.

A computer process typically includes an executing (running) program orportion of a program, current program values and state information, andthe resources used by the operating system to manage the execution ofthe process. An operating system (OS) is the software that manages thesharing of the resources of a computer and provides programmers with aninterface used to access those resources. An operating system processessystem data and user input, and responds by allocating and managingtasks and internal system resources as a service to users and programsof the system.

The computer system may for instance include at least one processingunit, associated memory and a number of input/output (I/O) devices. Whenexecuting the computer program, the computer system processesinformation according to the computer program and produces resultantoutput information via I/O devices.

In the foregoing specification, the invention has been described withreference to specific examples of embodiments of the invention. It will,however, be evident that various modifications and changes may be madetherein without departing from the broader spirit and scope of theinvention as set forth in the appended claims.

Those skilled in the art will recognize that the boundaries betweenlogic blocks are merely illustrative and that alternative embodimentsmay merge logic blocks or circuit elements or impose an alternatedecomposition of functionality upon various logic blocks or circuitelements. Thus, it is to be understood that the architectures depictedherein are merely exemplary, and that in fact many other architecturescan be implemented which achieve the same functionality.

Any arrangement of components to achieve the same functionality iseffectively ‘associated’ such that the desired functionality isachieved. Hence, any two components herein combined to achieve aparticular functionality can be seen as ‘associated with’ each othersuch that the desired functionality is achieved, irrespective ofarchitectures or intermediary components. Likewise, any two componentsso associated can also be viewed as being ‘operably connected’, or‘operably coupled’, to each other to achieve the desired functionality.

Furthermore, those skilled in the art will recognize that boundariesbetween the above described operations merely illustrative. The multipleoperations may be combined into a single operation, a single operationmay be distributed in additional operations and operations may beexecuted at least partially overlapping in time. Moreover, alternativeembodiments may include multiple instances of a particular operation,and the order of operations may be altered in various other embodiments.

Also for example, the examples, or portions thereof, may implemented assoft or code representations of physical circuitry or of logicalrepresentations convertible into physical circuitry, such as in ahardware description language of any appropriate type.

Also, the invention is not limited to physical devices or unitsimplemented in non-programmable hardware but can also be applied inprogrammable devices or units able to perform the desired devicefunctions by operating in accordance with suitable program code, such asmainframes, minicomputers, servers, workstations, personal computers,notepads, personal digital assistants, electronic games, automotive andother embedded systems, cell phones and various other wireless devices,commonly denoted in this application as ‘computer systems’.

However, other modifications, variations and alternatives are alsopossible. The specifications and drawings are, accordingly, to beregarded in an illustrative rather than in a restrictive sense.

In the claims, any reference signs placed between parentheses shall notbe construed as limiting the claim. The word ‘comprising’ does notexclude the presence of other elements or steps then those listed in aclaim. Furthermore, the terms ‘a’ or ‘an’, as used herein, are definedas one or more than one. Also, the use of introductory phrases such as‘at least one’ and ‘one or more’ in the claims should not be construedto imply that the introduction of another claim element by theindefinite articles ‘a’ or ‘an’ limits any particular claim containingsuch introduced claim element to inventions containing only one suchelement, even when the same claim includes the introductory phrases ‘oneor more’ or ‘at least one’ and indefinite articles such as ‘a’ or ‘an’.The same holds true for the use of definite articles. Unless statedotherwise, terms such as ‘first’ and ‘second’ are used to arbitrarilydistinguish between the elements such terms describe. Thus, these termsare not necessarily intended to indicate temporal or otherprioritization of such elements. The mere fact that certain measures arerecited in mutually different claims does not indicate that acombination of these measures cannot be used to advantage.

The invention claimed is:
 1. A method comprising: constructing anexpanded control flow graph of control flow paths through a computerprogram code, the expanded control flow graph includes a set of verticesincluding a first vertex, a second vertex, and a third vertex, whereinthe first vertex represents a first instance of a first block of linearcode in both a first control flow path and a second control flow paththrough the computer program code, the second vertex represents a secondinstance of a second block of linear code in the first control flowpath, and the third vertex represents a third instance of the secondblock of linear code in the second control flow path, wherein the firstblock of linear code is distinct from the second block of linear code,wherein the first vertex, the second vertex, and the third vertex aredistinct from each other; setting a cumulative instruction count valuefor the first control flow path to a predetermined number; incrementingthe cumulative instruction count value for the first control flow pathby a number of instructions within the first vertex to generate a firstcumulative instruction count value for the first vertex; incrementingthe first cumulative instruction count value by a number of instructionswithin the second vertex to generate a second cumulative instructioncount value for the second vertex; setting a third cumulativeinstruction count value for the second control flow path to thepredetermined number; incrementing the third cumulative instructioncount value for the second control flow path by the number ofinstructions within the first vertex to generate a fourth cumulativeinstruction count value for the first vertex; incrementing the fourthcumulative instruction count value by the number of instructions withinthe third vertex to generate a fifth cumulative instruction count valuefor the third vertex; and inserting at least one probe within thecomputer program code to enable the first cumulative instruction countvalue, the second cumulative instruction count value, the fourthcumulative instruction count value, or the fifth cumulative instructioncount value to be accessed.
 2. The method of claim 1 further comprisingaccessing the cumulative instruction count value for the at least onecontrol flow path of the computer program code.
 3. The method of claim 1wherein the expanded control flow graph comprising vertices representingindividual instances of blocks of code within different control flowpaths through the computer program code.
 4. The method of claim 3further comprising determining cumulative instruction count values forthe vertices within the expanded control flow graph.
 5. The method ofclaim 1 further comprising determining a reduced set of probes to beinserted within the computer program code.
 6. The method of claim 5wherein the reduced set of probes to be inserted within the computerprogram code is determined based at least partly on the cumulativeinstruction count values for the vertices within the expanded controlflow graph.
 7. The method of claim 3 wherein the method furthercomprises: constructing a control flow graph of the computer programcode comprising vertices representing blocks of code within the computerprogram code; and expanding the control flow graph to comprise verticesrepresenting individual instances of blocks of code within differentcontrol flow paths through the program code.
 8. The method of claim 7further comprising identifying at least one loop hitting vertex withinthe computer program code.
 9. The method of claim 8 further comprisingexpanding the at least one loop hitting vertex to comprise at least onefrom a group consisting of: at least one reference vertex; at least onereturn vertex; and at least one regressive edge from the at least onereturn vertex to the at least one reference vertex.
 10. The method ofclaim 5 further comprising determining a reduced set of probes to beimplemented within the computer program code, whereby the reduced set ofprobes comprises at least one from a group of: at least one probe withinat least one exiting vertex of the computer program code; and at leastone probe within at least one vertex represented by a loop hitting setvertex of the expanded control flow graph.
 11. The method of claim 10wherein the reduced set of probes comprises at least one probe within atleast one exiting vertex of the computer program code, and the methodfurther comprises inserting the at least one probe within the at leastone exiting vertex of the computer program code, whereby the at leastone probe incorporated within the at least one exiting vertex of thecomputer program code is arranged to read and output an instructioncount for the execution of the computer program code.
 12. The method ofclaim 10 wherein the reduced set of probes comprises at least one probewithin at least one vertex represented by a loop hitting set vertex ofthe expanded control flow graph; and the method further comprisesincorporating the at least one probe within the at least one vertexrepresented by a loop hitting set vertex, whereby the at least one probeis arranged to bound an instruction count for the execution of thecomputer program code.
 13. A method of determining control flow duringexecution of computer program code, the method comprising: inserting atleast one probe within the computer program code in accordance with themethod of claim 1; executing the computer program code within aninstruction processing module; receiving an indication of an instructioncount value for the execution of the computer program code; anddetermining at least one control flow path during the execution of thecomputer program code based at least partly on the received indicationof an instruction count value therefor.
 14. The method of claim 1wherein the cumulative instruction count value is a sum of instructionswithin the computer program code up to and including a vertex.
 15. Amethod comprising: constructing a first control flow graph of thecomputer program code, wherein the first control flow graph has a firstnumber of vertices representing blocks of linear code, wherein a firstvertex represents a first block of linear code and a second vertexrepresents a second block of linear code, wherein the first block oflinear code is distinct from the second block of linear code; expandingthe first control flow graph to create an expanded control flow diagramto provide a second number of vertices to represent individual instancesof the blocks of linear code, wherein the second number of vertices isgreater than the first number of vertices, and wherein the second numberof vertices includes the first vertex, the second vertex, and a thirdvertex, wherein the first vertex represents a first instance of a firstblock of linear code in both a first control flow path and a secondcontrol flow path through the computer program code, the second vertexrepresents a second instance of a second block of linear code in thefirst control flow path, and the third vertex represents a thirdinstance of the second block of linear code in the second control flowpath, wherein the first vertex, the second vertex, and the third vertexare distinct from each other; setting a cumulative instruction countvalue for the first control flow path to a predetermined number;incrementing the cumulative instruction count value for the firstcontrol flow path by a number of instructions within the first vertex togenerate a first cumulative instruction count value for the firstvertex; incrementing the first cumulative instruction count value by anumber of instructions within the second vertex to generate a secondcumulative instruction count value for the second vertex; setting athird cumulative instruction count value for the second control flowpath to the predetermined number; incrementing the third cumulativeinstruction count value for the second control flow path by the numberof instructions within the first vertex to generate a fourth cumulativeinstruction count value for the first vertex; incrementing the fourthcumulative instruction count value by the number of instructions withinthe third vertex to generate a fifth cumulative instruction count valuefor the third vertex; and determining a cumulative instruction countvalue for each vertex in the expanded control flow graph, wherein thecumulative instruction count value is a sum of instructions within thecomputer program code up to and including a vertex.
 16. The method ofclaim 15 further comprising: inserting at least one probe within thefirst vertex in the computer program code to enable a cumulativeinstruction count value for a control flow path at the first vertex tobe accessed.
 17. The method of claim 15 wherein the first vertex is alast in execution order vertex in the computer program code.
 18. Themethod of claim 15 further comprising: setting a cumulative instructioncount value for a second control flow path through the computer programcode to the predetermined value; incrementing the cumulative instructioncount value for the second control flow path by a number of instructionswithin the third vertex of the second control path to generate a thirdcumulative instruction count value for the third vertex; incrementingthe third cumulative instruction count value by a number of instructionswithin the fourth vertex of the second control path to generate a fourthcumulative instruction count value for the fourth vertex; incrementingthe fourth cumulative instruction count value by a number ofinstructions within a fifth vertex of the second control path togenerate a fifth cumulative instruction count value for the fifthvertex, wherein the second vertex and the fifth vertex are differentinstances of a same vertex of the computer program code; and inserting aprobe within the fifth vertex to enable the fifth cumulative instructioncount value for the second control flow path to be accessed.
 19. Amethod comprising: setting a cumulative instruction count value for afirst control flow path through the computer program code to apredetermined value; incrementing the cumulative instruction count valuefor the first control flow path by a number of instructions within afirst vertex of the first control path to generate a first cumulativeinstruction count value for the first vertex, wherein the first vertexrepresents a first instance of a first block of linear code in thecomputer program code; incrementing the first cumulative instructioncount value by a number of instructions within a second vertex of thefirst control path to generate a second cumulative instruction countvalue for the second vertex, wherein the second vertex represents asecond instance of a second block of linear code in the first controlflow path, wherein the first block of linear code is distinct from thesecond block of linear code; setting a third cumulative instructioncount value for a second control flow path through the computer programcode to the predetermined value; incrementing the third cumulativeinstruction count value for the second control flow path by the numberof instructions within the first vertex of the second control path togenerate a fourth cumulative instruction count value for the firstvertex, wherein the first vertex represents the first instance of thefirst block of linear code in the computer program code; incrementingthe fourth cumulative instruction count value by a number ofinstructions within a third vertex of the second control path togenerate a fifth cumulative instruction count value for the thirdvertex, wherein the third vertex represents a third instance of thesecond block of linear code in the second control path of the computerprogram code, wherein the first vertex, the second vertex, and the thirdvertex are distinct from each other; and inserting a probe within thesecond vertex to enable the second cumulative instruction count valuefor the first control flow path to be accessed.
 20. The method of claim19 further comprising: constructing a control flow graph of the computerprogram code comprising vertices representing blocks of code within thecomputer program code; and expanding the control flow graph to comprisevertices representing individual instances of blocks of code withindifferent control flow paths through the program code.